
#include "BuildinMath.h"

#include "Texture.h"


#ifndef UTILS_MATERIAL
#define UTILS_MATERIAL

#include <vector>

#include <memory>

class Material {
public:
    std::string name;
    Vector3f Ka;    // 环境光反射系数
    Vector3f Kd;    // 漫反射系数
    Vector3f Ks;    // 镜面反射系数
    float Ns;       // 镜面高光指数
    float Ni;       // 折射率
    float d;        // 透明度
    int illum;      // 光照模型编号
    std::shared_ptr<Texture> map_Ka;  	// Ambient Texture Map
    std::shared_ptr<Texture> map_Kd;  	// Diffuse Texture Map
    std::shared_ptr<Texture> map_Ks;  	// Specular Texture Map
    std::shared_ptr<Texture> map_Ns;  	// Specular Hightlight Map
    std::shared_ptr<Texture> map_d;  	// Alpha Texture Map
    std::shared_ptr<Texture> map_bump;	// Bump / Normal Map

    Material() {
        Ka = ZeroVector3f;
        Kd = ZeroVector3f;
        Ks = ZeroVector3f;
        Ns = 0.0f;
        Ni = 0.0f;
        d = 0.0f;
        illum = 0;
        map_Ka = nullptr;
        map_Kd = nullptr;
        map_Ks = nullptr;
        map_Ns = nullptr;
        map_d = nullptr;
        map_bump = nullptr;
    }

    static std::shared_ptr<Material> DefaultDiffuseMaterial() {
        auto material = std::make_shared<Material>();
        material->Ka = Vector3f(0.1f);
        material->Kd = Vector3f(0.8f);
        material->Ks = Vector3f(0.0f);
        material->Ns = 32.f;
        material->Ni = 1.f;
        material->d = 1.f;
        material->illum = 1;
        return material;
    }
};

#endif // UTILS_MATERIAL
